<?php
$base = "http://" . $_SERVER['SERVER_NAME'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en">
    <head>
        <meta charset="utf-8">            
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <meta name="description" content="">
                    <meta name="author" content="">

                        <!-- Le styles -->
                        <script src="<?= $base ?>/bootstrap/js/jquery.min.js"></script>
                        <link href="<?= $base ?>/bootstrap/css/bootstrap.css" rel="stylesheet" />
                        <script src="<?= $base ?>/bootstrap/js/bootstrap.js"></script>   
                        <title>Welcome to Admin Panel | Project Geannie</title>
                        <style type="text/css">
                            body {
                                padding-top: 60px;
                                padding-bottom: 40px;
                            }
                        </style>
                        <link href="<?= $base ?>/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">

                            <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
                            <!--[if lt IE 9]>
                              <script src="<?= $base ?>/bootstrap/js/html5shiv.js"></script>
                            <![endif]-->

                            <!-- Fav and touch icons -->    
                            <!--<link rel="shortcut icon" href="../assets/ico/favicon.png">-->
                            </head>

                            <body>

                                <div class="navbar navbar-fixed-top navbar-inverse">
                                    <div class="navbar-inner">
                                        <div class="container">
                                            <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                                                <span class="icon-bar"></span>
                                                <span class="icon-bar"></span>
                                                <span class="icon-bar"></span>
                                            </button>
                                            <a class="brand" href="<?= $this->url(array(), 'dashboard'); ?>"><i class="icon-white icon-tasks"></i> Project Geannie</a>
                                            <div class="nav-collapse collapse">
                                                <ul class="nav pull-right">

                                                    <?php if (!Zend_Auth::getInstance()->hasIdentity()) { ?>
                                                        <li><a href="<?= $this->url(array(), 'login'); ?>"><i class="icon-white icon-check"></i> Login</a></li>
                                                        <?php
                                                    } else {
                                                        $validUser = new Validations_User();
                                                        $name = $validUser->getUserName();

                                                        #get total users count
                                                        $userDb = new Application_Model_Users();
                                                        $userCounts = sizeof($userDb->fetchAll());
                                                        #project counts
                                                        $projectDb = new Application_Model_Project();
                                                        $projectCounts = sizeof($projectDb->fetchAll());
                                                        ?>
                                                        <li><a href="">Welcome, <?= $name ?></a></li>
                                                        <li><a href="<?= $this->url(array(), 'home'); ?>"><i class="icon-white icon-home"></i> Home</a></li>
                                                        <li><a href="<?= $this->url(array(), 'users-index'); ?>"><i class="icon-white icon-user"></i> Users (<?= $userCounts ?>)</a></li>
                                                        <li><a href="<?= $this->url(array(), 'project'); ?>"><i class="icon-white icon-th-list"></i> Projects (<?=$projectCounts?>)</a></li>
                                                        <li class="dropdown" key="adminsettings"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-white icon-wrench"></i> Settings <b class="caret"></b></a>
                                                            <ul class="dropdown-menu">
                                                                <li><a href="<?= $this->url(array(), 'cloudinary'); ?>"><i class="icon-picture"></i> Cloudinary</a></li>
                                                            </ul>
                                                        </li>
                                                        <li><a href="<?= $this->url(array(), 'logout'); ?>"><i class="icon-white icon-off"></i> Logout</a></li>
<?php }
?>                                                    
                                                </ul>
                                            </div><!--/.nav-collapse -->
                                        </div>
                                    </div>
                                </div>

                                <div class="container">
<?php echo $this->layout()->content ?>                           
                                    <hr>

                                        <footer>
                                            <p>&copy; SpearBall Inc. 2013</p>
                                        </footer>

                                </div> <!-- /container -->
                            </body>
                            </html>
